﻿@page "/"
@inject StateService State
@inject IJSRuntime JS
<h1>Hello, world!</h1>

Welcome to your new app.

Current state is:
<p id="app-state">@State.GetCurrentState()</p>

<!-- Elements to help testing functionality -->
<p id="test-helpers">
    <button id="test-clear-storage" @onclick="ClearStorage">Clear storage</button>
    <button id="test-refresh-page" @onclick="TriggerPageRefresh">Refresh page</button>
</p>

@code{
    public async Task ClearStorage()
    {
        await JS.InvokeVoidAsync("sessionStorage.clear");
    }

    public async Task TriggerPageRefresh()
    {
        await JS.InvokeVoidAsync("location.reload", true);
    }
}
